﻿<%@ Page Title="POSSystem | Suppliers" Theme="POSSystem" Language="C#" MasterPageFile="~/Application.Master"
    AutoEventWireup="true" CodeBehind="Supplier.aspx.cs" Inherits="WebUI.Supplier" %>
<%@ Register Src="~/Controls/SysControls/GridFilterPaging.ascx" TagName="GridFilterPaging"
    TagPrefix="uc" %>
<%@ Register Src="~/Controls/POSControls/SupplierListCtrl.ascx" TagPrefix="uc" TagName="SupplierList" %>
<%@ Register Src="~/Controls/SysControls/PageHeader.ascx" TagPrefix="uc" TagName="PageHeader" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ApplicationHeadHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ApplicationContentHolder" runat="server">

    <script type="text/javascript">
        function onAddSupplier() {
            var id = getSelectedItemID<%=lstSupplier.ClientID %>();
            var returnValue = window.showModalDialog('<%=GetSupplierEditPageLink() %>' + '&mode=new', '', 'dialogWidth=450px;dialogHeight=300px;resizable=no;help=no;unadorned=yes;');

            return returnValue > 0;
        }

        function onEditSupplier() {
            var id = getSelectedItemID<%=lstSupplier.ClientID %>();
            if(id == null){
                alert("No item was selected!");
                return false;
            }
            var returnValue = window.showModalDialog('<%=GetSupplierEditPageLink() %>' + '&mode=edit&id=' + id, '', 'dialogWidth=450px;dialogHeight=300px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }
        

        function onRemoveSupplier() {
            var id = HasCheckedItems<%=lstSupplier.ClientID %>();
            if(id == false){
                alert("No item was selected!");
                return false;
            }
            
            return confirm("This action will delete all checked items. Do you want to continue?");
        }
        
        function showPrintDlg(key){
            var returnValue = window.showModalDialog(key, '', 'dialogWidth=800px;dialogHeight=600px;resizable=yes;help=no;unadorned=yes;');
        }
    </script>

    <uc:PageHeader ID="pageHeader" Text="Suppliers" ImageURL="~/Images/Provider.png" runat="server" />
    <table width="100%">
        <tr>
            <td style="width: 100%; text-align: left; vertical-align: top">
                <asp:Panel ID="panel" runat="server" class="primaryPanel" DefaultButton="btnSearch" >
                    <div class="titleBar">
                        <asp:Label ID="lblTitle1" runat="server" CssClass="titleContent">Supplier List</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder">
                        <div>
                            <asp:UpdatePanel ID="update1" runat="server" UpdateMode="Conditional">
                                 <Triggers>
                                    <asp:PostBackTrigger ControlID="btnExcel" />
                                </Triggers>
                                <ContentTemplate>
                                    <table width="100%" class="toolbar">
                                        <tr>
                                            <td style='vertical-align: middle'>
                                                <asp:LinkButton class="tbbutton" ID="btnAddSupplier" runat="server" OnClientClick="return onAddSupplier();"
                                                    OnClick="btnAddSupplier_OnClick" >
                                                    <img src="Images/AddRecord.gif" /><asp:Label ID="label5" runat="server" Text="Add"></asp:Label>
                                                </asp:LinkButton>
                                                <asp:LinkButton class="tbbutton" ID="btnEditSupplier" runat="server" OnClientClick=" return onEditSupplier();"
                                                    OnClick="btnAddSupplier_OnClick">
                                                    <img src="Images/Edit.gif" /><asp:Label ID="label6" runat="server" Text="Edit"></asp:Label>
                                                </asp:LinkButton>
                                                <asp:LinkButton class="tbbutton" ID="btnDeleteSupplier" runat="server" OnClientClick="return onRemoveSupplier();"
                                                    OnClick="btnRemoveSupplier_OnClick">
                                                    <img src="Images/Delete.gif" /><asp:Label ID="label7" runat="server" Text="Delete"></asp:Label>
                                                </asp:LinkButton>
                                                <img src="Images/tbSep.png" />
                                                <asp:LinkButton class="tbbutton" ID="btnPrintCust" runat="server" OnClick="btnPrintSupplier_OnClick">
                                                    <img src="Images/print.gif" /><asp:Label ID="label8" runat="server" Text="Print"></asp:Label>
                                                </asp:LinkButton>
                                                <asp:LinkButton class="tbbutton" ID="btnExcel" runat="server" OnClick="btnExcel_OnClick">
                                                    <img src="Images/excel.gif" /><asp:Label ID="label9" runat="server" Text="Export"></asp:Label>
                                                </asp:LinkButton>
                                                <img src="Images/tbSep.png" />
                                                <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                                                <asp:LinkButton class="tbbutton" ID="btnSearch" runat="server" OnClick="btnSearchSupplier_OnClick">
                                                    <img src="Images/search.png" />
                                                </asp:LinkButton>
                                                <img src="Images/tbSep.png" />
                                                <asp:LinkButton class="tbbutton" ID="btnReload" runat="server" OnClick="btnReload_OnClick">
                                                    <img src="Images/reload.png" /><asp:Label ID="label11" runat="server" Text="Reload"></asp:Label>
                                                </asp:LinkButton>
                                            </td>
                                        </tr>
                                    </table>
                                    <asp:UpdatePanel ID="updateGrid" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                            <uc:SupplierList Width="100%" ID='lstSupplier' runat="server" AllowPaging="true"
                                                AllowSelecting="true" AllowSorting="true" SaveOnCommit="false" />
                                            <asp:HiddenField ID="hidSelectedSupplier" runat="server" />
                                            <div style="height: 10px">
                                                &nbsp;</div>
                                            <uc:GridFilterPaging ID="gridFilterPaging" runat="server" FilteredField="SupplierName"
                                                OnNeedListControl="gridFilterPaging_OnNeedListControl" />
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                    </div>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
